wayland/surface: Make sure to commit ack_configure
authorJonas Ådahl <jadahl@gmail.com>
Thu, 17 Sep 2020 16:20:08 +0000 (18:20 +0200)
committerJonas Ådahl <jadahl@gmail.com>
Thu, 17 Sep 2020 16:20:08 +0000 (18:20 +0200)
We must wl_surface.commit after xdg_surface.ack_configure to make it
have an effect. We failed to do so when a configure event didn't result
in new updates, so make sure we fall back on an simple
wl_surface.commit if there was no new actual frame painted.

Closes: #2910
gdk/wayland/gdkcairocontext-wayland.c
gdk/wayland/gdkglcontext-wayland.c
gdk/wayland/gdkprivate-wayland.h
gdk/wayland/gdksurface-wayland.c
gdk/wayland/gdkvulkancontext-wayland.c

index d0fc54d0b0fd64cc4b43a4142d20ac5be33f235d..fcc547ecf600453f78d94f96e4e74d5c96ff367c 100644 (file)
@@ -185,6 +185,7 @@ gdk_wayland_cairo_context_end_frame (GdkDrawContext *draw_context,
 
   gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
   gdk_wayland_surface_commit (surface);
+  gdk_wayland_surface_notify_committed (surface);
 
   gdk_wayland_cairo_context_surface_clear_region (self->paint_surface);
   self->paint_surface = NULL;
index 8ed0bb1d49f7783b320d8758563c77f7530bde5f..a668731196f1932263f4b110e6ba8161d0520f38 100644 (file)
@@ -261,6 +261,8 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
     }
   else
     eglSwapBuffers (display_wayland->egl_display, egl_surface);
+
+  gdk_wayland_surface_notify_committed (surface);
 }
 
 static void
index db45a07c085c9bc5fcc9e98c11df09d90bd00918..11c6cefed4e43684fdcb64dd84a16809a6d3272d 100644 (file)
@@ -95,6 +95,7 @@ guint      _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
 
 void       gdk_wayland_surface_sync (GdkSurface *surface);
 void       gdk_wayland_surface_commit (GdkSurface *surface);
+void       gdk_wayland_surface_notify_committed (GdkSurface *surface);
 void       gdk_wayland_surface_request_frame (GdkSurface *surface);
 void            gdk_wayland_surface_attach_image           (GdkSurface           *surface,
                                                             cairo_surface_t      *cairo_surface,
index bda30ae39ca5b9434c22bcad55b7a060a3d1ef5b..aee98a2d488083d2362a5501c51c199d16330dd5 100644 (file)
@@ -94,6 +94,7 @@ struct _GdkWaylandSurface
   PopupState popup_state;
 
   unsigned int initial_configure_received : 1;
+  unsigned int has_uncommitted_ack_configure : 1;
   unsigned int mapped : 1;
   unsigned int awaiting_frame : 1;
   unsigned int awaiting_frame_frozen : 1;
@@ -622,12 +623,26 @@ gdk_wayland_surface_commit (GdkSurface *surface)
   wl_surface_commit (impl->display_server.wl_surface);
 }
 
+void
+gdk_wayland_surface_notify_committed (GdkSurface *surface)
+{
+  GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
+
+  impl->has_uncommitted_ack_configure = FALSE;
+}
+
 static void
 on_frame_clock_after_paint (GdkFrameClock *clock,
                             GdkSurface    *surface)
 {
   GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
 
+  if (surface->update_freeze_count == 0 && impl->has_uncommitted_ack_configure)
+    {
+      gdk_wayland_surface_commit (surface);
+      gdk_wayland_surface_notify_committed (surface);
+    }
+
   if (impl->awaiting_frame &&
       impl->pending_frame_counter == gdk_frame_clock_get_frame_counter (clock))
     {
@@ -1458,6 +1473,8 @@ gdk_wayland_surface_configure (GdkSurface *surface)
       impl->pending.is_initial_configure = TRUE;
     }
 
+  impl->has_uncommitted_ack_configure = TRUE;
+
   if (is_realized_popup (surface))
     gdk_wayland_surface_configure_popup (surface);
   else if (is_realized_toplevel (surface))
index fa2f89c8d8c65e8b0e179c44526ecbe31c4f056e..ee88e8e66c0e879039b03a94c00be9455331a466 100644 (file)
@@ -69,6 +69,8 @@ gdk_vulkan_context_wayland_end_frame (GdkDrawContext *context,
   gdk_wayland_surface_request_frame (surface);
 
   GDK_DRAW_CONTEXT_CLASS (gdk_wayland_vulkan_context_parent_class)->end_frame (context, painted);
+
+  gdk_wayland_surface_notify_committed (surface);
 }
 
 static void